package com.dd.cloud.user.task;

import com.dd.cloud.user.service.doctor.IDoctorDetailService;
import com.dd.cloud.user.service.pres.IPresPrescriptionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description: 监管平台数据迁移的定时器
 * @Author: czg
 * @Date: 2023/10/23 16:16
 * @Version: 1.0.0
 */
@Component
@Slf4j
public class SuperviseTask {
    @Autowired
    private IDoctorDetailService doctorDetailService;
    @Autowired
    private IPresPrescriptionService presPrescriptionService;

    /**
     * 发送医生数据到监管平台
     */
    //@Scheduled(cron = "0 0 20 * * ?")
    //@SchedulerLock(name = "sendDocDataToSupervise", lockAtLeastForString = "PT2M", lockAtMostForString = "PT10M")
    public void sendDocDataToSupervise() {
        log.info("定时器每天零点二十处理，发送医生数据到监管平台");
        doctorDetailService.sendDocDataToSupervise();
    }

    /**
     * 发送处方,诊断,病历,患者数据到监管平台
     */
    //@Scheduled(cron = "0 0 20 * * ?")
    //@SchedulerLock(name = "sendPresDataToSupervise", lockAtLeastForString = "PT2M", lockAtMostForString = "PT10M")
    public void sendPresDataToSupervise() {
        log.info("定时器每天零点二十处理，发送处方数据到监管平台");
        presPrescriptionService.sendDDataToSupervise();
    }
}
